import { createRouter, createWebHashHistory } from "vue-router";
import Home from "../views/zb-home.vue"
import Login from "../views/zb-login.vue"
import HelloWorld from "../components/HelloWorld.vue"
import NewGenerator from "../views/NewGenerator.vue"
import ZbCustomer from "../views/customer/zb-customer.vue"
/**
 * 创建路由对象
 */
const routes = [{
    path: '/',
    redirect: '/Login'
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/home',
    component: Home,
    redirect: '/helloWorld',
    meta: {title: '首页', name: 'HelloWorld'},
    children:[
      {
        path: '/helloWorld',
        name: 'HelloWorld',
        text: '首页',
        meta: {title: '首页', name: 'HelloWorld'},
        component: HelloWorld
      },
      {
        path: 'NewGenerator',
        name: 'NewGenerator',
        text: '代码生成器',
        meta: {title: '代码生成器', name: 'ZbGenerator'},
        component: NewGenerator
      },
      {
        path: 'ZbCustomer',
        name: 'ZbCustomer',
        text: '客户列表',
        meta: {title: '客户管理', name: 'ZbCustomer'},
        component: ZbCustomer
      }
    ]
  }
]

/**
 * 初始化路由 配置
 */
const router = createRouter({
  history: createWebHashHistory(),
  routes
});

/**
 * 导出路由
 */
export default router